const SQL_TABLE = 'user',
SQL_SELECT = 'select id,username from ' + SQL_TABLE;

exports.findByUsernamePassword = (un, pd, resolve) => {
	resolve = resolve || (() => {});
	global.pool.query(SQL_SELECT + ' where username=? and password=?', [un, pd], (err, rows, fields) => {
		if (err)
			throw err;
		if (rows.length > 0)
			resolve(rows[0]);
		else
			resolve(null)
	})
}
